package cn.kgc.cjk_yy.controller;

import cn.kgc.cjk_yy.pojo.DevUser;
import cn.kgc.cjk_yy.service.DevUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2018/9/14 0014.
 */
@Controller
public class DevUserController {

    //用户登录操作  实例注解注入
    @Resource
    private DevUserService devUserService;

    //用户登录
    @RequestMapping(value="dev_user_login",method = RequestMethod.POST)
    public String dev_user_login(@RequestParam("devcode") String devcode, @RequestParam("password") String password, HttpServletRequest request) throws Exception {
        DevUser user= devUserService.dev_user_login(devcode, password);
        if(null==user){
            return "dev_user_login";
        }else{
            request.getSession().setAttribute("devUser",user);
            return "dev_user/userShow";
        }
    }
}
